package com.shujia.day05;


class Rectangle {
    private double length;
    private double width;

    private double perimeter; //周长
    private double area;


    public Rectangle() {
    }

    public Rectangle(double length, double width) {
        this.length = length;
        this.width = width;
        this.perimeter = 2 * (length + width);
        this.area = length * width;
    }

    public double getPerimeter() {
        return perimeter;
    }


    public double getArea() {
        return area;
    }


}


public class Code04Test {
    public static void main(String[] args) {
        Rectangle rectangle = new Rectangle(4.0, 3.0);
        System.out.println("周长：" + rectangle.getPerimeter());
        System.out.println("面积：" + rectangle.getArea());
    }
}
